using System;
using System.Drawing;
using Themez;

namespace UILayer.DPAppUIForms
{
	public class Images
	{
		private static Image[] images = null;
		private static Theme m_Theme;

		public static void Init(Image m)
		{
			string themePath = ThemeManager.GetDefaultThemePath();
			if( themePath != String.Empty )
			{
				try
				{
					m_Theme = new Theme(themePath);
				}
				catch
				{
					m_Theme = null;
				}
			}
			
			if( m_Theme == null )
			{
				System.Windows.Forms.MessageBox.Show(null,
					"Unable to read the theme file,the icons will be unavailable",
					"Theme support not available");
				Bitmap bitmap = (Bitmap)m;
				int count = (int) (bitmap.Width / bitmap.Height);
				images = new Image[count];
				Rectangle rectangle = new Rectangle(0, 0, bitmap.Height, bitmap.Height);
				for (int i = 0; i < count; i++)
				{
					images[i] = bitmap.Clone(rectangle, bitmap.PixelFormat);
					rectangle.X += bitmap.Height;
				}
			}
		}
		public static Image NewProject 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("NewProject"); } }
		public static Image NewPlugin 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("NewPlugin"); } }
		public static Image NewComponent 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("NewComponent"); } }
		public static Image OpenProject 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("OpenProject"); } }
		public static Image OpenPlugin 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("OpenPlugin"); } }
		public static Image PrintCurrentComponent 	{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("PrintCurrentComponent"); } }
		public static Image PrintEntireComponent 	{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("PrintEntireComponent"); } }
		public static Image Save 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Save"); } }
		public static Image Exit 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Exit"); } }
		public static Image Toolbox 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Toolbox"); } }
		public static Image Projects 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Projects"); } }
		public static Image AddDesignPatterns 		{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("AddDesignPatterns"); } }
		public static Image Engineering 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Engineering"); } }
		public static Image CodeGenerators 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("CodeGenerators"); } }
		public static Image ReverseEngineering 		{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("ReverseEngineering"); } }
		public static Image Cascade 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Cascade"); } }
		public static Image Vertical 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Vertical"); } }
		public static Image Horizontal 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Horizontal"); } }
		public static Image Manual 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Manual"); } }
		public static Image About 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("About"); } }
		public static Image GPL 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("GPL"); } }
		public static Image DPType 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("DPType"); } }
		public static Image DP 						{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("DP"); } }
		public static Image AddDPFromFile 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("AddDPFromFile"); } }
		public static Image Image 					{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Image"); } }
		public static Image ImageCurrentComponent 	{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("ImageCurrentComponent"); } }
		public static Image ImageEntireProject 		{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("ImageEntireProject"); } }
		public static Image ImageClipBoard 			{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("ImageClipBoard"); } }
		public static Image Enlarge 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Enlarge"); } }
		public static Image Decrease 				{ get{ return m_Theme == null ? images[0] : m_Theme.GetIcon("Decrease"); } }
	}	
}
